#ifndef INTERPRETATOR_H
#define INTERPRETATOR_H

#include <QObject>
//#include <QStringList>
//#include <QDir>
//#include <QMap>
#include <QTextStream>

class Interpretator:public QObject{
    Q_OBJECT
public:
    explicit Interpretator(QObject *parent = 0);
    int translateFKOL(const char* path,const bool& option);
//    int translateCPP(const char* path);
    QString version() const{return QString("v1.0");}
private:
    enum State{
        NoClass,
        NoImplementation,
//        WaitImplementation,
        InImplementation//,
//        HasImplementation
    } _state;
    enum DeclarationPart{
        publicFunc,
        publicSlot,
        protectedFunc,
        protectedSlot,
        privateFunc,
        privateSlot
    };

    int processLine(QString line);
    int processComment(QString line);
    int processCommand(QString line);
    int processRawCode(QString line);
    int saveCppCode(const QString& path,const bool& option);

    int processNameLibrary(QString arguments);
    int processObject(QString arguments);
    int processDeclaration(QString arguments);
    int processCustom(QString arguments);
    int processEnd(QString arguments);

    void pushImplementation();

    int _row;
    bool _inited;
    bool _deinited;
    QString _nameLibrary;
    QString _nameLibraryIncluder;
    QString _beginImplementation;
    QString _currentImplementation;
    QString _headerBegin;
    QString _classDeclarator;
    QString _declarators;
    QString _classEnd1;
    QString _classEnd2;
    QString _classEnd3;
    QString _realization;
    QString _className;
    QString _customVals;
    QString _customRealVals;
    QString _customSetters;
    QString _customSettersImplementation;
    QString _customGetters;
    QString _customGettersImplementation;
    QString _customTakers;
    QString _customTakersImplementation;
    QString _customChangers;
    QString _customChangersImplementation;
    QString _customRegistrators;
    QString _customDeclarators;
    QTextStream out;
};

#endif // INTERPRETATOR_H
